<script lang="ts" setup>
import { ref, reactive } from "vue"
import { useCascaderAreaData } from "@vant/area-data"

import "@/utils/rem"
document.title = ""
const formData = reactive<any>({})
const checked = ref(false)
/**联级选择 */
const show = ref<boolean>(false)

const carderAd = ref<string>("")
const adCity = ref<string>("")
const cascaderValue = ref<string>("")
const options = useCascaderAreaData()
const onFinish = ({ selectedOptions }: any) => {
  show.value = false
  // console.log(selectedOptions.map((option: any) => option.text))
  adCity.value = selectedOptions.map((option: any) => option.text)[1]
  carderAd.value = selectedOptions.map((option: any) => option.text).join("/")
  // console.log(adCity.value)
}
</script>
<template>
  <div class="img">
    <img src="http://8.136.98.140/image/xm.jpg" alt="" />
    <div class="form" style="position: relative">
      <van-form>
        <van-cell-group inset>
          <van-field v-model="formData.h5_card_name" name="姓名" label="姓名" size="small" placeholder="请输入身份证姓名(已加密)" />
          <van-field v-model="formData.h5_card_id" name="身份证" label="身份证号" size="small" placeholder="请输入身份证号(已加密)" />
          <van-field v-model="formData.h5_phone" name="联系电话" label="联系电话" type="tel" size="small"
            placeholder="请填写并保持通话通畅" />
          <van-field v-model="carderAd" is-link size="small" readonly label="收货地址" placeholder="请选择所在地区"
            @click="show = true" />
          <van-popup v-model:show="show" round position="bottom">
            <van-cascader v-model="cascaderValue" title="请选择所在地区" :options="options" @close="show = false"
              @finish="onFinish" />
          </van-popup>
          <van-field v-model="formData.h5_address" name="详细地址" label="详细地址" size="small" placeholder="如街道,道路,小区,门牌号" />
          <van-checkbox v-model="checked" label-disabled style="font-size: 12px; margin-top: 0.1rem" icon-size="18px"
            checked-color="#07c160">我已同意 <span class="cp">《入网协议》</span><span class="cp">《用户隐私政策》</span></van-checkbox>
        </van-cell-group>
        <div style="margin-top: -0.3rem" class="pbtn btn1">
          <van-button round block type="success" native-type="submit"> 免费领取,包邮到家 </van-button>
        </div>
      </van-form>
    </div>
    <img style="padding-bottom: 1rem" src="http://8.136.98.140/image/xmt.jpg" alt="" />
  </div>
</template>
<style lang="scss" scoped>
.img {
  width: 7.5rem;
  margin: 0 auto;
}

img {
  width: 100%;
}

:deep(.van-cell-group) {
  background-color: transparent;
}

:deep(.van-cell) {
  background-color: #000;
  color: #fff;
  margin-bottom: 0.1rem;
  border-radius: 0.5rem;
  line-height: 0.6rem;
  // padding: 0.16rem;
  font-size: 12px;
}

:deep(.van-field__label) {
  color: #fff;
}

:deep(.van-field__control) {
  color: #fff;
}

:deep(.van-button--block) {
  width: 7rem;
  height: 0.7rem;
  margin: 0.4rem auto;
}

:deep(.van-cell:after) {
  border-bottom: 0;
}

:deep(.van-checkbox__label) {
  vertical-align: bottom;
  color: #000;
}

.cp {
  cursor: pointer;
}

.pbtn {
  position: fixed;
  bottom: 0;
  left: 50%;
  margin-left: -3.5rem;
}

.btn1 {
  animation: myfirs_a 1.5s infinite;
}

.btn2 {
  position: relative;
  z-index: -1;
}

.number {
  animation: myfirs_b 1.5s infinite;
  font-style: normal;
  color: red;
}

@keyframes myfirs_a {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.02);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes myfirs_b {
  0% {
    font-size: 12px;
  }

  50% {
    font-size: 14px;
  }

  100% {
    font-size: 12px;
  }
}

.orderSearch {
  position: fixed;
  padding: 0.24rem 0.3rem;
  // padding-right: 0.2rem;
  top: 1rem;
  right: -0.2rem;
  background-color: rgba(255, 255, 255, 0.8);
  color: #000;
  border: 0;
  font-size: 14px;
  font-weight: 700;
}

::-webkit-scrollbar {
  display: none;
  /* Chrome Safari */
}

.form {
  padding: 0.3rem 0.2rem;
  // background-color: #fff;
}

.itemicon {
  padding-left: 0.14rem;
  margin-bottom: 0.2rem;
  font-size: 14px;
  color: #3976ff;
  font-weight: bold;
  margin-top: 0.2rem;
}

.itemicon::before {
  content: " ";
  position: absolute;
  width: 2px;
  height: 9px;
  top: 50%;
  left: 0;
  transform: translate(0, -4.5px);
  background: #3976ff;
}

.van-hairline--bottom::after {
  border-bottom-width: 1px;
}

[class*="van-hairline"]::after {
  content: " ";
  position: absolute;
  pointer-events: none;
  box-sizing: border-box;
  top: -50%;
  left: -50%;
  right: -50%;
  bottom: -50%;
  -webkit-transform: scale(0.5);
  transform: scale(0.5);
  border: 0 solid #eee;
}

[class*="van-hairline"] {
  position: relative;
}

:deep(.van-uploader__upload) {
  width: 3rem;
  height: 2rem;
}

:deep(.van-uploader__preview-image) {
  width: 3rem;
  height: 2rem;
}

.photo {
  margin-top: 0.2rem;
}

.example {
  width: 3rem;
  height: 2rem;
  vertical-align: top;
}

.text_left {
  text-align: left;
}

.uploader-tip {
  color: #333;
  font-size: 12px;
  // text-align: center;
  display: inline-block;
  width: 100%;
  border-bottom: 1px solid #f7f8fa;
  padding-bottom: 0.1rem;
  margin-bottom: 0.1rem;
}

.wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  height: 100%;
}

.block123 {
  width: 120px;
  height: 120px;
  // background-color: #fff;
}

.block {
  width: 100%;
  text-align: center;

  img {
    width: 100%;
    height: 100%;
  }
}

:deep(.van-overlay) {
  background: rgba(0, 0, 0, 0.6);
}
</style>
